import { defineStore } from 'pinia';

interface ItemBrandState {
  contractList: string[];
  pickingIdList: string[];
  currentContract: string;
  currentPickingId: string;
  billData: any;
  brandModelData: any;
}

export const useItemBrandStore = defineStore('itemBrand', {
  state: (): ItemBrandState => ({
    contractList: [],
    pickingIdList: [],
    currentContract: '',
    currentPickingId: '',
    billData: null,
    brandModelData: null
  }),
  
  actions: {
    // 设置合同列表
    setContractList(contractList: string[]) {
      this.contractList = contractList;
    },
    
    // 设置识别码列表
    setPickingIdList(pickingIdList: string[]) {
      this.pickingIdList = pickingIdList;
    },
    
    // 设置当前选中的合同
    setCurrentContract(contract: string) {
      this.currentContract = contract;
    },
    
    // 设置当前选中的识别码
    setCurrentPickingId(pickingId: string) {
      this.currentPickingId = pickingId;
    },
    
    // 设置签单数据
    setBillData(billData: any) {
      this.billData = billData;
    },
    
    // 设置品牌型号数据
    setBrandModelData(brandModelData: any) {
      this.brandModelData = brandModelData;
    },
    
    // 重置所有数据
    resetAll() {
      this.contractList = [];
      this.pickingIdList = [];
      this.currentContract = '';
      this.currentPickingId = '';
      this.billData = null;
      this.brandModelData = null;
    }
  }
}); 